# Copyright 2018- The Pixie Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "vizier",
    srcs = [
        "client.go",
        "connector.go",
        "data_formatter.go",
        "errors.go",
        "lister.go",
        "script.go",
        "stream_adapter.go",
        "utils.go",
    ],
    importpath = "px.dev/pixie/src/pixie_cli/pkg/vizier",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/api/go/pxapi/utils",
        "//src/api/proto/cloudpb:cloudapi_pl_go_proto",
        "//src/api/proto/vispb:vis_pl_go_proto",
        "//src/api/proto/vizierpb:vizier_pl_go_proto",
        "//src/pixie_cli/pkg/auth",
        "//src/pixie_cli/pkg/components",
        "//src/pixie_cli/pkg/pxanalytics",
        "//src/pixie_cli/pkg/pxconfig",
        "//src/pixie_cli/pkg/script",
        "//src/pixie_cli/pkg/utils",
        "//src/shared/services",
        "//src/utils",
        "//src/utils/shared/k8s",
        "@com_github_fatih_color//:color",
        "@com_github_gofrs_uuid//:uuid",
        "@com_github_sirupsen_logrus//:logrus",
        "@in_gopkg_segmentio_analytics_go_v3//:analytics-go_v3",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
        "@io_k8s_client_go//kubernetes",
        "@io_k8s_client_go//rest",
        "@org_golang_google_grpc//:go_default_library",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//metadata",
        "@org_golang_google_grpc//status",
        "@org_golang_x_sync//errgroup",
    ],
)

go_test(
    name = "vizier_test",
    srcs = ["data_formatter_test.go"],
    embed = [":vizier"],
    deps = [
        "//src/api/proto/vizierpb:vizier_pl_go_proto",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
